package BLL;

import DAL.BorrowDao;
import DAL.LogDao;
import Entity.Borrow;

import java.util.Date;
import java.util.List;

/**
 * 图书借阅
 * @Author Chen
 * @Date 2022/1/6 19:21
 * @Version 1.0
 */
public class BorrowBookService {
    static LogDao ld=new LogDao();
    static BorrowDao bd=new BorrowDao();
    //图书借阅
    public static int  borrowBook(Object... rage){
        int i = bd.addBorrowInfo(rage);
        Date date=new Date();
        String s="图书借阅信息！";
        ld.insertloginLog(date,s);
        return i;
    }

    //图书归还
    public static int returnBook(Object... rage){
        int i = bd.updateBorrowInfo(rage);
        Date date=new Date();
        String s="图书归还！";
        ld.insertloginLog(date,s);
        return i;
    }

    //图书指定信息查看
    public static Borrow seeBook(Object... rage){
        Borrow borrows = bd.selectBorrowInfoByBookId(rage);
        Date date=new Date();
        String s="图书指定信息查看！";
        ld.insertloginLog(date,s);
        return borrows;
    }

    //查看所有的书籍
    public static List<Borrow> lookBook(){
        List<Borrow> borrows = bd.selectAllBorrowInfo();
        Date date=new Date();
        String s="查看所有的书籍！";
        ld.insertloginLog(date,s);
        return borrows;
    }
}
